import 'package:flutter/material.dart';
import 'package:flutter_hotwork/bean/AllRiBaoBiaoBean.dart';
import 'package:flutter_hotwork/utils/DioUtils.dart';

///图片展示widget
class ImageGlideWidget extends StatelessWidget {
  final List list;
  ImageGlideWidget({this.list});

  @override
  Widget build(BuildContext context) {
    return list == null
        ? Container()
        : Container(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                // Container(child: Text("照片文件",style: TextStyle(fontSize: 16))),
                GridView.builder(
                    shrinkWrap: true,
                    itemCount: list.length,
                    gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                        //横轴元素个数
                        crossAxisCount: 3,
                        //纵轴间距
                        mainAxisSpacing: 10.0,
                        //横轴间距
                        crossAxisSpacing: 10.0,
                        //子组件宽高长度比例
                        childAspectRatio: 1.4),
                    itemBuilder: (context, index) {
                      return Image.network(DioUtils.API_PREFIX +list[index],
                          width: double.maxFinite,
                          height: double.maxFinite,
                          repeat: ImageRepeat.repeat);
                    })
              ],
            ),
          );
  }
}
